package com.huanf.response;

import lombok.Data;

@Data
public class ResponseResult<T> {

    private Integer code;
    private T data;
    private String by = "b站 涣沷a靑惷";

    public static <T> ResponseResult success(T t) {
        ResponseResult<T> ResponseResult = new ResponseResult<>();
        ResponseResult.setCode(200);
        ResponseResult.setData(t);
        return ResponseResult;
    }

    public static <T> ResponseResult fail(int code, T data) {
        ResponseResult<T> ResponseResult = new ResponseResult<>();
        ResponseResult.setCode(code);
        ResponseResult.setData(data);
        return ResponseResult;
    }

    public static ResponseResult mailSuccess() {
        ResponseResult ResponseResult = new ResponseResult();
        ResponseResult.setCode(200);
        ResponseResult.setData("邮件发送成功，请留意查收");
        return ResponseResult;
    }

    public static ResponseResult mailFail() {
        ResponseResult ResponseResult = new ResponseResult();
        ResponseResult.setCode(465);
        ResponseResult.setData("邮件发送失败，请检查服务器465端口是否放行");
        return ResponseResult;
    }
}